#ifndef CONNECTIONMANAGER_H_
#define CONNECTIONMANAGER_H_

#include <iostream>
#include <pthread.h>
#include "HighLevelConnection.h"
#include "WebSocketBroadcaster.h"
using namespace std;

class ConnectionManager: public WebSocketBroadcaster {
public:
	ConnectionManager();
	virtual ~ConnectionManager();
	void newHTTPConnection(int sockfd);
	void newWebSocketConnection(int sockfd, string location);
	void removeConnection(HighLevelConnection* conn);

private:
	void addConnection(HighLevelConnection* conn);
	HighLevelConnection** connList;
	int connCount;
	pthread_rwlock_t connListLock;
};

#endif /* CONNECTIONMANAGER_H_ */
